<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserScoresHistory extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        Schema::create('user_scores_history', function(Blueprint $table)
        {
            $table->increments('id');
            $table->integer('user_id');
            $table->integer('unique_event')->nullable();
            $table->string('action');
            $table->integer('score');
            $table->string('ip');
            $table->string('user_agent');
            $table->string('request_url');
            $table->integer('operator_id');
            $table->timestamps();

            $table->unique(array('user_id', 'unique_event'));
        });
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
        Schema::dropIfExists('user_scores_history');
	}

}
